Open
Conversation
…subclasses QTreeView
aaronayres35
commented
Jul 1, 2021
Comment on lines
+73
to
+84
| tree_widget = self.source._tree | ||
| i_column = self.location.column | ||
| i_rows = iter(self.location.row) | ||
| item = tree_widget.topLevelItem(next(i_rows)) | ||
| for i_row in i_rows: | ||
| item = item.child(i_row) | ||
| q_model_index = tree_widget.indexFromItem(item, i_column) | ||
| return dict( | ||
| model=tree_widget.model(), | ||
| view=tree_widget, | ||
| index=q_model_index, | ||
| ) |
Contributor
Author
There was a problem hiding this comment.
This logic and the TreeNode object having a row/column I need to think about more carefully. I had this code in a branch locally from a long time ago which I believe had originally been pulled from one of Kit's draft PRs.
There may be a simple way to do this / at the very least I need to better document the TreeNode class to say what row and column actually specify. In this case (see test_TreeEditor_demo.py) row is a tuple containing the index of the node of interest at subsequent levels of the tree, and column is the index at that last level (?). I have just been using column as 0, ... it may be possible we only need one single tuple to do this TreeNode location.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds UITester support for the qt
TreeEditor. Note that some of the changes made here are identical to those made in #1707 (ie _interaction_helpers that work withQAbstractItemModel). This PR also currently adds a simple test for theTreeEditor_demobut I have not yet updated actual Tree Editor tests.Checklist